<?php
/**
 * Created by PhpStorm.
 * User: chenzhitao
 * Date: 2018/1/4
 * Time: 下午4:45
 */

namespace App\Providers;


use Illuminate\Support\Facades\Response;
use Illuminate\Support\ServiceProvider;

class ResponseMacroServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Response::macro('packet', function ($value = null) {
            $ret = app()->makeWith(\App\Http\Response::class, ['data' => $value]);
            return $ret;
        });

        //第三方对接专用
//        Response::macro('thirdPacket', function ($value = null) {
//            $ret = app()->makeWith(\App\Http\ThirdResponse::class, ['data' => $value]);
//            return $ret;
//        });
    }
}